// JavaScript Document
function ischecked1(){//本人是否参加英语考试
if (document.getElementById("eng_text_no").checked) 
{ 

  document.getElementById("english_text_type").disabled = true;
  document.getElementById("listening").disabled = true;
  document.getElementById("speaking").disabled = true;
  document.getElementById("reading").disabled = true;
  document.getElementById("writing").disabled = true;


  }
  if (document.getElementById("eng_text_yes").checked) 
{ 
  
  document.getElementById("english_text_type").disabled = false;
  document.getElementById("listening").disabled = false;
  document.getElementById("speaking").disabled = false;
  document.getElementById("reading").disabled = false;
  document.getElementById("writing").disabled = false;
  }
}
function ischecked2(){//配偶是否参加英语考试
if (document.getElementById("eng_text_no2").checked) 
{ 

  document.getElementById("english_text_type2").disabled = true;
  document.getElementById("listening2").disabled = true;
  document.getElementById("speaking2").disabled = true;
  document.getElementById("reading2").disabled = true;
  document.getElementById("writing2").disabled = true;


  }
  if (document.getElementById("eng_text_yes2").checked) 
{ 
  
  document.getElementById("english_text_type2").disabled = false;
  document.getElementById("listening2").disabled = false;
  document.getElementById("speaking2").disabled = false;
  document.getElementById("reading2").disabled = false;
  document.getElementById("writing2").disabled = false;
  }
}


function ismarried(){//是否已婚
if (document.getElementById("marriage_n").checked) 
{ 
   
  document.getElementById("birthday2").disabled = true;
  document.getElementById("eng_text_yes2").disabled = true;
  document.getElementById("eng_text_no2").disabled = true;
  document.getElementById("english_text_type2").disabled = true;
  document.getElementById("listening2").disabled = true;
  document.getElementById("speaking2").disabled = true;
  document.getElementById("reading2").disabled = true;
  document.getElementById("writing2").disabled = true;
  document.getElementById("workinaus_yes2").disabled = true;
  document.getElementById("workinaus_no3").disabled = true;
  document.getElementById("par_job1").disabled = true;
  document.getElementById("par_country1").disabled = true;
  document.getElementById("par_work_starttime1").disabled = true;
   document.getElementById("par_work_endtime1").disabled = true;
  document.getElementById("workinaus_yes4").disabled = true;
  document.getElementById("workinaus_no4").disabled = true;
  document.getElementById("out_aus_work2").disabled = true;
  document.getElementById("in_aus_work2").disabled = true;
   document.getElementById("paraddTR").disabled = true;
  
  document.getElementById("par_qua").disabled = true;
  document.getElementById("major22").disabled = true;
  document.getElementById("begintime22").disabled = true;
  document.getElementById("endtime22").disabled = true;
  document.getElementById("majorcountry22").disabled = true;
   document.getElementById("addparbachelorID").disabled= true;
  

  //document.form1.txt1.focus();
  }
  if (document.getElementById("marriage_y").checked) 
{ 
  //document.getElementById("par1").disabled = false;
 document.getElementById("birthday2").disabled = false;
  document.getElementById("eng_text_yes2").disabled = false;
  document.getElementById("eng_text_no2").disabled = false;
  document.getElementById("english_text_type2").disabled = false;
  document.getElementById("listening2").disabled = false;
  document.getElementById("speaking2").disabled = false;
  document.getElementById("reading2").disabled = false;
  document.getElementById("writing2").disabled = false;
  document.getElementById("workinaus_yes2").disabled = false;
  document.getElementById("workinaus_no3").disabled =false;
  document.getElementById("par_job1").disabled =false;
  document.getElementById("par_country1").disabled =false;
  document.getElementById("par_work_starttime1").disabled =false;
   document.getElementById("par_work_endtime1").disabled =false;
  document.getElementById("workinaus_yes4").disabled =false;
  document.getElementById("workinaus_no4").disabled =false;
  document.getElementById("out_aus_work2").disabled =false;
  document.getElementById("in_aus_work2").disabled = false;
   document.getElementById("paraddTR").disabled =false;
 document.getElementById("par_qua").disabled = false;
  document.getElementById("major22").disabled =false;
  document.getElementById("begintime22").disabled = false;
  document.getElementById("endtime22").disabled = false;
  document.getElementById("majorcountry22").disabled = false;
document.getElementById("addparbachelorID").disabled= false;
  }
}
//是否有工作经历
function iswork1(){
if (document.getElementById("workinaus_no").checked) 
{ 

 // document.getElementById("english_text_type2").disabled = true;
  document.getElementById("country1").disabled = true;
  document.getElementById("work_starttime1").disabled = true;
  document.getElementById("work_endtime1").disabled = true;
  document.getElementById("job1").disabled = true;
  document.getElementById("IaddTR").disabled = true;

  }
  if (document.getElementById("workinaus_yes").checked) 
{ 
  
  document.getElementById("country1").disabled = false;
  document.getElementById("work_starttime1").disabled =false;
  document.getElementById("work_endtime1").disabled = false;
  document.getElementById("job1").disabled = false;
  document.getElementById("IaddTR").disabled =false;
  }
}
function iswork2(){
if (document.getElementById("workinaus_no3").checked) 
{ 

 // document.getElementById("english_text_type2").disabled = true;
  document.getElementById("par_job1").disabled = true;
  document.getElementById("par_country1").disabled = true;
  document.getElementById("par_work_starttime1").disabled = true;
  document.getElementById("par_work_endtime1").disabled = true;
  document.getElementById("paraddTR").disabled = true;

  }
  if (document.getElementById("workinaus_yes2").checked) 
{ 
 
  document.getElementById("par_job1").disabled = false;
  document.getElementById("par_country1").disabled = false;
  document.getElementById("par_work_starttime1").disabled = false;
  document.getElementById("par_work_endtime1").disabled = false;
  document.getElementById("paraddTR").disabled = false;
  }
}
/*//显示与隐藏
function oncheck()
{
	if(document.getElementById("have_pary").checked)
	   document.getElementById("div").style.display= "block";
	 if(document.getElementById("have_parn").checked)
	   document.getElementById("div").style.display= "none";
}*/
function check()
{
    var a=document.myform.name;
	if(a==null){window.alert("请输入");}
}
function showItems()
{
 if (document.getElementById("marriage_y").checked) 
 	{
	document.getElementById("tr1").style.display= "";
 /*  document.getElementById("tr2").style.display= "block";
    document.getElementById("tr3").style.display= "block";
	 document.getElementById("tr4").style.display= "block";
	  document.getElementById("tr5").style.display= "block";
	   document.getElementById("tr6").style.display= "block";*/
 	}
 if (document.getElementById("marriage_n").checked) 
{ 
	document.getElementById("tr1").style.display= "none";
   document.getElementById("tr2").style.display= "none";
    document.getElementById("tr3").style.display= "none";
	 document.getElementById("tr4").style.display= "none";
	  document.getElementById("tr5").style.display= "none";
	   document.getElementById("tr6").style.display= "none";
}

}
function display(){
      var traget=document.getElementById('tr1');
       if(traget.style.display=="none"){
              traget.style.display="";
       }else{
              traget.style.display="none";
     }
  }
    function checkISNull()
    		  {
    	         var name=document.add.name;
    	         var city=document.add.city;
    	         var immicountry=document.add.immicountry;
    	         var email=document.add.email;
    	         var telnumber=document.add.phonenumber;
    	         var qq=document.add.QQ;
    	         var weixin=document.add.weixin;
    	         if(name.value.length==0){ 
    	        	 alert("姓名不能为空！"); 
    	        	 name.focus(); 
    	        	 return false; 
    	        	 }
    	         if(city.value.length==0){ 
    	        	 alert("居住城市不能为空！"); 
    	        	 city.focus(); 
    	        	 return false; 
    	        	 }
    	         if(immicountry.value.length==0){ 
    	        	 alert("拟移民国家不能为空！"); 
    	        	 immicountry.focus(); 
    	        	 return false; 
    	        	 }
    	         if(email.value.length==0){ 
    	        	 alert("邮箱不能为空"); 
    	        	 email.focus(); 
    	        	 return false; 
    	        	 }
    	         if(email.value.length!=0){ 
    	        	    var pattern = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;  
    	        	    if (!pattern.test(email.value)) {  
    	        	        alert("请输入正确的邮箱地址!");  
    	        	        email.focus();  
    	        	        return false;  
    	        	    }
    	        	 }
    	         if(telnumber.value.length==0){ 
    	        	 alert("电话号码不能为空"); 
    	        	 telnumber.focus(); 
    	        	 return false; 
    	        	 }
    	        if(telnumber.value.length!=0){    	        
    	        	var pattern=/(^(\d{2,4}[-_－—]?)?\d{3,8}([-_－—]?\d{3,8})?([-_－—]?\d{1,7})?$)|(^0?1\d{10}$)/;
    	        	    if (!pattern.test(telnumber.value)) {  
    	        	        alert("请输入正确的电话号码!");  
    	        	        email.focus();  
    	        	        return false;  
    	        	    }
    	        	 }

    	         if(qq.value.length==0){ 
    	        	 alert("QQ号码不能为空"); 
    	        	 qq.focus(); 
    	        	 return false; 
    	        	 }
    	         if(qq.value.length!=0){ 
    	         	var pattern= /^\d{5,11}$/;
    	        	if (!pattern.test(qq.value)) {  
    	        	        alert("请输入正确的QQ号码!");  
    	        	        qq.focus();  
    	        	        return false;  
    	        	    }
    	        	 }
    	    /*    if(qq.value.length!=0){ 
    	        	 
    	        	var pattern = /[1-9][0-9]{1,}/;  
    	        	    if (!pattern.test(email.value)) {  
    	        	        alert("请输入正确的QQ号码!");  
    	        	        qq.focus();  
    	        	        return false;  
    	        	    }
    	        	 }*/
    	        if(weixin.value.length==0){ 
    	        	 alert("微信号不能为空"); 
    	        	 telnumber.focus(); 
    	        	 return false; 
    	        	 }
    	         var birthday1=document.add.birthday1;
    	         if(birthday1.value.length==0){ 
    	        	 alert("出生日期不能为空"); 
    	        	 birthday1.focus(); 
    	        	 return false; 
    	        	 }
    	        if(birthday1.value.length!=0)
    	        {
    	           var date=birthday1.value;
    	           var year=date.substr(0,4);             
                   var month=date.substr(5,2); 
                    var day=date.substr(8,2);  
                    
    	           var d = new Date();
    	           var nowyear= d.getFullYear();
    	            var nowmonth=d.getMonth()+1;
    	            var nowday=d.getDate();
    	      
    	               
    	           if(year-nowyear>0){
                      alert("出生日期错误！");
                      birthday1.focus(); 
                      return  false;
                     }
                     else{
                     if(month-nowmonth>0){
                     	alert("出生日期错误！");
                     	birthday1.focus(); 
                     	return false;
                     }
                     else
                     {
                     if(day-nowday>=0){
                     	alert("出生日期错误");
                     	birthday1.focus(); 
                     	return false;
                     }
                     }
                     }
    	        }
    	         var res=false;
    	         for(var i=0;i<document.add.passExam.length;i++)
    	         {
    	           if(document.add.passExam[i].checked)
    	           {
    	        	   res=true;
    	        	  break;
    	           }   	         
    	         }
    	         if(res==false)
    	        	 { 
    	        	 alert("请选择是否通过英语考试！"); 
    	        	 return res;
    	        	 }    	        	
    	         res=false;
    	         for(var i=0;i<document.add.offjob.length;i++)
    	         {
    	           if(document.add.offjob[i].checked)
    	           {
    	        	   res=true;
     	        	  break;
    	           }   	         
    	         }
    	         if(res==false)
	        	 { 
	        	 alert("请选择过去十年是否具有工作经验"); 
	        	 return res;
	        	 } 
    	         res=false;
    	         for(var i=0;i<document.add.ishasTiWorkEx.length;i++)
    	         {
    	           if(document.add.ishasTiWorkEx[i].checked)
    	           {
    	        	   res=true;
     	        	  break;
    	           }   	         
    	         }
    	         if(res==false)
	        	 { 
	        	 alert("请选择过去十年是否具有与提名职业相关的工作经验"); 
	        	 return res;
	        	 }
    	      
    	         res=false;
    	         for(var i=0;i<document.add.isMarry.length;i++)
    	         {
    	           if(document.add.isMarry[i].checked)
    	           {
    	        	   res=true;
     	        	  break;
    	           }   	         
    	         }
    	         
    	         if(res==false)
	        	 { 
	        	 alert("请选择是否已婚！"); 
	        	 return res;
	        	 } 
	        	  res==false;
	        	 if(document.add.isMarry[0].checked)//已婚
    	           {
    	           	    var Partnerbirthday=document.add.Partnerbirthday;
    	                if(Partnerbirthday.value.length==0)
    	             	{ 
    	        	        alert("配偶出生日期不能为空"); 
    	        	        Partnerbirthday.focus(); 
    	        	        return false; 
    	        	    }
    	        if(Partnerbirthday.value.length!=0)
    	        {
    	           var date=Partnerbirthday.value;
    	           var year=date.substr(0,4);             
                   var month=date.substr(5,2); 
                    var day=date.substr(8,2);  
                    
    	           var d = new Date();
    	           var nowyear= d.getFullYear();
    	            var nowmonth=d.getMonth()+1;
    	            var nowday=d.getDate();
    	      
    	               
    	           if(year-nowyear>0){
                      alert("配偶出生日期错误！");
                      Partnerbirthday.focus(); 
                      return  false;
                     }
                     else{
                     if(month-nowmonth>0){
                     	alert("配偶出生日期错误！");
                     	Partnerbirthday.focus(); 
                     	return false;
                     }
                     else
                     {
                     if(day-nowday>=0){
                     	alert("配偶出生日期错误");
                     	Partnerbirthday.focus(); 
                     	return false;
                     }
                     }
                     }
    	        }
    	        	   if(Partnerbirthday.value.length!=0){
    	        	  
    	        	     	// alert(document.add.ParishasTiWorkEx.length);
    	                res==false;
    	                if(!document.add.ParishasTiWorkEx[0].checked&&!document.add.ParishasTiWorkEx[1].checked)
    	                 {
    	             
    	        	        res=false;
    	                  }   	         
                         if(res==false)
	        	         { 
	        	             alert("请选择配偶是否过去两年内是否具有至少一年的职业提名相关工作经历"); 
	        	              return res;
	        	          } 
    	        	    }
    	       
    	           }   
    	         return res;
    		  }